function [User Afriat LawOfDemand sarp Flag vpairs] = testGarp(user,x,p,nprobs)

nusers = size(x,1)/nprobs;

Afriat = zeros(nusers,1);
User = zeros(nusers,1);
sarp = zeros(nusers,1);
LawOfDemand = zeros(nusers,1);
v = zeros(nusers,9);
vpairs = zeros(nusers,1);
Flag = zeros(nusers,1);

['nprobs : ', nprobs];
nprobs;
nusers;
user(1:13,:);
x(1:13,:);
p(1:13,:);

format long

expenditure = sum(x.*p,2) * ones(1,size(x,2));
x = x ./ expenditure;
for i = 1:nusers
    User(i) = user(nprobs*i);
    x1 = x((i-1)*nprobs+1:i*nprobs,:);
    p1 = p((i-1)*nprobs+1:i*nprobs,:);
    User(i);
    [x1, p1];
    [expenditure, DRP, SDRP, RP, SRP, WARP, WGARP, GARP, SARP, FLAGS, VIO_PAIRS, VIOLATIONS, AFRIAT, VARIAN, HM,LD,SARP_ERRORS] = HPZ_Subject_Consistency(x1,p1);
    Afriat(i) = AFRIAT;
    LawOfDemand(i) = LD;
    sarp(i) = SARP_ERRORS;
    vpairs(i) = VIO_PAIRS(3);
    Flag(i) = FLAGS(3);
    v(i,:) = [VIOLATIONS (VIOLATIONS>0) AFRIAT];
    [i User(i) VIOLATIONS AFRIAT VIO_PAIRS(3)];
    [User(i) AFRIAT FLAGS(3)];
end
[User Afriat Flag];

res = [User Afriat LawOfDemand sarp Flag vpairs];
